package com.blunka.framework.client.ui.dialog;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.MatteBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.tree.DefaultMutableTreeNode;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import com.blunka.framework.client.constants.DesignConstant;
import com.blunka.framework.client.constants.InitDesignConfig;
import com.blunka.framework.client.db.druid.DBSQLService;
import com.blunka.framework.client.db.druid.service.ISQLService;
import com.blunka.framework.client.enums.ModelField;
import com.blunka.framework.client.enums.ModelStates;
import com.blunka.framework.client.enums.ModelStatus;
import com.blunka.framework.client.enums.ModelType;
import com.blunka.framework.client.ui.MainFrame;
import com.blunka.framework.client.ui.TreeModelPanel;
import com.blunka.framework.client.ui.entity.BlkTableMetaData;
import com.blunka.framework.client.ui.swing.BlkJComboBox;
import com.blunka.framework.client.utils.DesignUtils;

import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;

/**
 * 字段属性窗体
 * @author Administrator
 *
 */
public abstract class ProtyFieldDialog{

	private static final Logger logger = Logger.getLogger(ProtyDialog.class);
	/**
	 * 数据库服务
	 */
	private static ISQLService sqlHepler = DBSQLService.getLocalDBService();

	private JDialog dialog;

	private JPanel mainDialog;

	private JPanel gridPanel;

	private JPanel buttonPanel;

	private JLabel cnTextLabel; // 数据库类型

	private JTextField cnText;

	private JLabel enTextLabel; // 数据库驱动

	private JTextField enText; // 数据库驱动输入框

	private JTextField prefixText; // 前缀

	private String prefixValue; // 前缀名称

	private JLabel descriptionLabel;

	private JTextArea description;//描述

	private JLabel modelTypeLabel;

	private BlkJComboBox<String> modelTypeBox;//节点类型

	private JLabel objPathLabel;

	private JTextField objPathText;//路径

	private JLabel modelStatesLabel;

	private BlkJComboBox<String> modelStatesBox;//建模节点状态

	private JLabel fieldTypeLabel;

	private BlkJComboBox<String> fieldTypeBox;//字段类型

	private JLabel fieldLenLabel;

	private JFormattedTextField fieldLenText;//字段长度

	private JLabel primaryLabel;

	private BlkJComboBox<String> primaryBox;//是否主键

	private JLabel nullLabel;

	private BlkJComboBox<String> nullBox;//是否为空

	private JLabel showWidthLabel;

	private JFormattedTextField showWidthText;//显示长度

	private JLabel hiddenLabel;

	private BlkJComboBox<String> hiddenBox;//是否隐藏

	private JLabel viewLabel;

	private BlkJComboBox<String> viewBox;//是否可预览

	private JLabel readLabel;

	private BlkJComboBox<String> readBox;//是否只读

	private JLabel editLabel;

	private BlkJComboBox<String> editBox;//是否可编辑

	private JLabel groupLabel;

	private JTextField	groupText;//所属分组

	private JLabel errorLabel;

	private JTextField errorText;//错误提示

	private JLabel inputLabel;

	private JTextField inputText;//输入提示

	private JLabel configLabel;

	private JTextField configText;//自定义配置

	private JButton configBtn;

	private JLabel selLabel;

	private JTextField selText;//下拉字段配置

	private JButton selBtn;

	/**
	 * 修改
	 * @param title
	 * @param model
	 */
	public ProtyFieldDialog(String title,BlkTableMetaData model){
		initDialog(title, model.getModel_type());
		initCompomentValue(model);
		showDialogModel();
	}

	/**
	 * 新增
	 * @param title
	 * @param modelType
	 */
	public ProtyFieldDialog(String title, ModelType modelType) {
		initDialog(title, modelType);
		showDialogModel();
	}

	public String getEnText(){
		return prefixText.getText()+enText.getText();
	}

	public String getCnText(){
		return cnText.getText();
	}

	/**
	 * 初始化窗体
	 * @param title
	 * @param modelType
	 */
	private void initDialog(String title, ModelType modelType) {
		dialog = new JDialog();
		dialog.setTitle(title);


		dialog.setSize(new Dimension(650, 500));
		Container contentPanel = dialog.getContentPane();

		gridPanel = new JPanel();
		gridPanel.setLayout(null);

		cnTextLabel = new JLabel("节点名称：");
		cnTextLabel.setHorizontalAlignment(JLabel.RIGHT);
		cnText = new JTextField();
		gridPanel.add(cnTextLabel);
		gridPanel.add(cnText);
		cnTextLabel.setBounds(10, 10, 100, 25);
		cnText.setBounds(110, 10, 200, 25);

		enTextLabel = new JLabel("英文名称：");
		enTextLabel.setHorizontalAlignment(JLabel.RIGHT);
		enTextLabel.setBounds(300, 10, 100, 25);

		prefixText = new JTextField();
		prefixText.setBounds(400, 10, 50, 25);
		MatteBorder border = new MatteBorder(1, 1, 1, 0, new Color(192, 192, 192));
		prefixText.setBorder(border);
		prefixText.setEnabled(false);
		prefixText.setText(prefixValue);

		enText = new JTextField();
		MatteBorder border2 = new MatteBorder(1, 0, 1, 1, new Color(192, 192, 192));
		enText.setBounds(450, 10, 150, 25);
		enText.setBorder(border2);

		descriptionLabel = new JLabel("描述：");
		descriptionLabel.setHorizontalAlignment(JLabel.RIGHT);
		descriptionLabel.setBounds(10,40,100,25);
		description = new JTextArea();
		JScrollPane scroll = new JScrollPane(description);
		scroll.setBounds(110,40,200,40);

		//节点类型
		modelTypeLabel = new JLabel("节点类型：");
		modelTypeLabel.setHorizontalAlignment(JLabel.RIGHT);
		modelTypeLabel.setBounds(300, 40, 100, 25);
		modelTypeBox = getComBox(ModelType.class);
		modelTypeBox.setBounds(400, 40, 200, 25);
		//modelTypeBox.setSelectedIndex(ModelType.ATTRIBUTE.getIndex());
		modelTypeBox.setSelectedValue(ModelType.ATTRIBUTE);
		modelTypeBox.setEnabled(false);

		//路径
		objPathLabel = new JLabel("节点路径：");
		objPathLabel.setHorizontalAlignment(JLabel.RIGHT);
		objPathLabel.setBounds(10,85,100,25);
		objPathText = new JTextField();
		objPathText.setEditable(false);
		objPathText.setBounds(110,85,200,25);

		//建模节点状态
		modelStatesLabel = new JLabel("节点状态：");
		modelStatesLabel.setHorizontalAlignment(JLabel.RIGHT);
		modelStatesLabel.setBounds(300, 85, 100, 25);
		modelStatesBox = getComBox(ModelStates.class);
		modelStatesBox.setBounds(400, 85, 200, 25);
		//modelStatesBox.setSelectedIndex(ModelStates.NEW.getIndex());
		modelStatesBox.setSelectedValue(ModelStates.NEW);
		modelStatesBox.setEnabled(false);

		//字段类型
		fieldTypeLabel = new JLabel("字段类型：");
		fieldTypeLabel.setHorizontalAlignment(JLabel.RIGHT);
		fieldTypeLabel.setBounds(10,120,100,25);
		fieldTypeBox = getComBox(ModelField.class);
		fieldTypeBox.setBounds(110, 120, 200, 25);

		//字段长度
		fieldLenLabel = new JLabel("字段长度：");
		fieldLenLabel.setBounds(300, 120, 100, 25);
		fieldLenLabel.setHorizontalAlignment(JLabel.RIGHT);
		fieldLenText = new JFormattedTextField(new java.text.DecimalFormat("#0"));
		fieldLenText.setText("100");
		fieldLenText.setBounds(400, 120, 200, 25);

		//主键
		primaryLabel = new JLabel("是否主键：");
		primaryLabel.setHorizontalAlignment(JLabel.RIGHT);
		primaryLabel.setBounds(10,155,100,25);
		primaryBox = getComBox(ModelStatus.class);
		primaryBox.setBounds(110, 155, 200, 25);
		//primaryBox.setSelectedIndex(1);
		primaryBox.setSelectedValue(ModelStatus.NO);

		//是否为空
		nullLabel = new JLabel("是否为空：");
		nullLabel.setHorizontalAlignment(JLabel.RIGHT);
		nullLabel.setBounds(300, 155, 100, 25);
		nullBox = getComBox(ModelStatus.class);
		nullBox.setBounds(400, 155, 200, 25);

		//显示长度
		showWidthLabel = new JLabel("显示长度：");
		showWidthLabel.setHorizontalAlignment(JLabel.RIGHT);
		showWidthLabel.setBounds(10,190,100,25);
		showWidthText = new JFormattedTextField(new java.text.DecimalFormat("#0"));
		showWidthText.setText("150");
		showWidthText.setBounds(110, 190, 200, 25);

		//是否隐藏
		hiddenLabel = new JLabel("是否隐藏：");
		hiddenLabel.setHorizontalAlignment(JLabel.RIGHT);
		hiddenLabel.setBounds(300, 190, 100, 25);
		hiddenBox = getComBox(ModelStatus.class);
		hiddenBox.setBounds(400, 190, 200, 25);
		//hiddenBox.setSelectedIndex(1);
		hiddenBox.setSelectedValue(ModelStatus.NO);

		//是否预览
		viewLabel = new JLabel("是否可预览：");
		viewLabel.setHorizontalAlignment(JLabel.RIGHT);
		viewLabel.setBounds(10,225,100,25);
		viewBox = getComBox(ModelStatus.class);
		viewBox.setBounds(110, 225, 200, 25);

		//是否只读
		readLabel = new JLabel("是否只读：");
		readLabel.setHorizontalAlignment(JLabel.RIGHT);
		readLabel.setBounds(300, 225, 100, 25);
		readBox = getComBox(ModelStatus.class);
		readBox.setBounds(400, 225, 200, 25);
		//readBox.setSelectedIndex(1);
		readBox.setSelectedValue(ModelStatus.NO);

		//是否可编辑
		editLabel = new JLabel("是否可编辑：");
		editLabel.setHorizontalAlignment(JLabel.RIGHT);
		editLabel.setBounds(10,260,100,25);
		editBox = getComBox(ModelStatus.class);
		editBox.setBounds(110, 260, 200, 25);

		//所属分组
		groupLabel = new JLabel("所属分组：");
		groupLabel.setHorizontalAlignment(JLabel.RIGHT);
		groupLabel.setBounds(300, 260, 100, 25);
		groupText = new JTextField();
		groupText.setBounds(400, 260, 200, 25);

		//错误提示
		errorLabel = new JLabel("错误提示：");
		errorLabel.setHorizontalAlignment(JLabel.RIGHT);
		errorLabel.setBounds(10,295,100,25);
		errorText = new JTextField();
		errorText.setBounds(110, 295, 200, 25);

		//输入提示
		inputLabel = new JLabel("输入提示：");
		inputLabel.setHorizontalAlignment(JLabel.RIGHT);
		inputLabel.setBounds(300, 295, 100, 25);
		inputText = new JTextField();
		inputText.setBounds(400, 295, 200, 25);

		//自定义配置
		configLabel = new JLabel("自定义配置：");
		configLabel.setHorizontalAlignment(JLabel.RIGHT);
		configLabel.setBounds(10,330,100,25);
		configText = new JTextField();
		configText.setBounds(110, 330, 430, 25);
		configText.setEnabled(false);
		configBtn = new JButton();
		configBtn.setText("配置");
		configBtn.setBounds(540, 330, 60, 25);

		//下拉属性配置
		selLabel = new JLabel("下拉选择配置：");
		selLabel.setHorizontalAlignment(JLabel.RIGHT);
		selLabel.setBounds(10,365,100,25);
		selText = new JTextField();
		selText.setBounds(110, 365, 430, 25);
		selText.setEnabled(false);
		selBtn = new JButton("配置");
		selBtn.setBounds(540, 365, 60, 25);

		gridPanel.add(enTextLabel);
		gridPanel.add(prefixText);
		gridPanel.add(enText);
		gridPanel.add(descriptionLabel);
		gridPanel.add(scroll);
		gridPanel.add(modelTypeLabel);
		gridPanel.add(modelTypeBox);
		gridPanel.add(objPathLabel);
		gridPanel.add(objPathText);
		gridPanel.add(modelStatesLabel);
		gridPanel.add(modelStatesBox);
		gridPanel.add(fieldTypeLabel);
		gridPanel.add(fieldTypeBox);
		gridPanel.add(fieldLenLabel);
		gridPanel.add(fieldLenText);
		gridPanel.add(primaryLabel);
		gridPanel.add(primaryBox);
		gridPanel.add(nullLabel);
		gridPanel.add(nullBox);
		gridPanel.add(showWidthLabel);
		gridPanel.add(showWidthText);
		gridPanel.add(hiddenLabel);
		gridPanel.add(hiddenBox);
		gridPanel.add(viewLabel);
		gridPanel.add(viewBox);
		gridPanel.add(readLabel);
		gridPanel.add(readBox);
		gridPanel.add(editLabel);
		gridPanel.add(editBox);
		gridPanel.add(groupLabel);
		gridPanel.add(groupText);
		gridPanel.add(errorLabel);
		gridPanel.add(errorText);
		gridPanel.add(inputLabel);
		gridPanel.add(inputText);
		gridPanel.add(configLabel);
		gridPanel.add(configText);
		gridPanel.add(configBtn);
		gridPanel.add(selLabel);
		gridPanel.add(selText);
		gridPanel.add(selBtn);

		configBtn.addActionListener(userConfigAction());
		selBtn.addActionListener(rangConfigAction());


		enText.addFocusListener(new FocusListener() {
			@Override
			public void focusGained(FocusEvent arg0) {

			}

			@Override
			public void focusLost(FocusEvent arg0) {
				String text = enText.getText();
				if (!StringUtils.isEmpty(text)) {
					enText.setText(text.toUpperCase());
				}

			}

		});
		cnText.getDocument().addDocumentListener(addListener());

		buttonPanel = new JPanel();
		JButton buttonOK = new JButton("确   定");
		buttonOK.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if (cnText.getText().trim().equals("")) {
					DesignUtils.showMessage(dialog, "请输入中文显示名称", "系统提示", JOptionPane.INFORMATION_MESSAGE);
					return;
				}
				if(DesignUtils.isSqlKeyWord(enText.getText().trim())) {
					DesignUtils.showMessage(dialog, "输入的英文名称不合法", "系统提示", JOptionPane.INFORMATION_MESSAGE);
					return;
				}
				try{
					TreeModelPanel treePanel = TreeModelPanel.newInstance();
					DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) treePanel.getTree().getLastSelectedPathComponent();
					BlkTableMetaData parentTableMetaData = (BlkTableMetaData)parentNode.getUserObject();

					BlkTableMetaData node = new BlkTableMetaData();
					node.setZh_cn(getCnText());
					node.setEn_us(getEnText());
					node.setModel_type(modelType);

					if(node.getModel_type() == ModelType.TABLE || node.getModel_type() == ModelType.VIEW){

						//表或者试图需要验证是否已经数据库建立
						if(sqlHepler.queryTableOrViewExists(node)){
							logger.error("节点属性【"+node.getEn_us()+",已经存在】,或者存在已删除的节点但是还没有提交，请先提交！");
							DesignUtils.showMessage(dialog, "属性【"+node.getEn_us()+",已经存在】",DesignConstant.PROMIT_TITLE, JOptionPane.ERROR_MESSAGE);
							return;
						}
					}else if(node.getModel_type() == ModelType.ATTRIBUTE){
						//字段属性所属表
						node.setFather_tablemetadata_id(parentTableMetaData.getTablemetadata_id());
						//字段需要验证在当前所有子节点下是否存在
						if(sqlHepler.queryTableOrViewFieldExists(node, parentTableMetaData.getEn_us())){
							logger.error("节点属性【"+node.getEn_us()+",已经存在】,或者存在已删除的节点但是还没有提交，请先提交！");
							DesignUtils.showMessage(dialog, "节点属性已经存在",DesignConstant.PROMIT_TITLE, JOptionPane.ERROR_MESSAGE);
							return;
						}
					}
					dialog.dispose();


					BlkTableMetaData model = new BlkTableMetaData();
					model.setZh_cn(getCnText());
					model.setEn_us(getEnText());
					model.setDescribes(description.getText());
					model.setObj_path(objPathText.getText());
					model.setModel_states(ModelStates.getEnum(modelStatesBox.getSelectedItem().toString()));
					model.setModel_type(ModelType.getEnum(modelTypeBox.getSelectedItem().toString()));
					model.setModel_field(ModelField.getEnum(fieldTypeBox.getSelectedItem().toString()));
					model.setModel_field_len(Integer.parseInt(fieldLenText.getText()));
					model.setIs_primary_key(ModelStatus.getEnum(primaryBox.getSelectedItem().toString()));
					model.setIs_empty(ModelStatus.getEnum(nullBox.getSelectedItem().toString()));
					model.setShow_width(Integer.parseInt(showWidthText.getText()));
					model.setIs_hidden(ModelStatus.getEnum(hiddenBox.getSelectedItem().toString()));
					model.setIs_viewer(ModelStatus.getEnum(viewBox.getSelectedItem().toString()));
					model.setIs_reader(ModelStatus.getEnum(readBox.getSelectedItem().toString()));
					model.setIs_disabled(ModelStatus.getEnum(editBox.getSelectedItem().toString()));
					model.setError_msg(errorText.getText());
					model.setInput_promit(inputText.getText());
					model.setGroup_title(groupText.getText());
					model.setUser_config(configText.getText());
					model.setSel_options(selText.getText());
					//model.setGuidtag(System.currentTimeMillis());
				    //调用回调函数
				    callBack(model);
				}catch(Exception ex){
					DesignUtils.showMessage(dialog, "执行异常,请查看日志面板异常信息!",DesignConstant.PROMIT_TITLE, JOptionPane.ERROR_MESSAGE);
					logger.error(ex);
				}

			}
		});
		JButton buttonNo = new JButton("取   消");
		buttonNo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dialog.dispose();
				return;
			}
		});

		buttonPanel.add(buttonOK);
		buttonPanel.add(buttonNo);
		buttonOK.setBounds(200, 10, 100, 25);
		buttonNo.setBounds(250, 10, 100, 25);

		mainDialog = new JPanel();
		mainDialog.setLayout(new BorderLayout());
		mainDialog.add(new JScrollPane(gridPanel), BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout());
		contentPanel.add(mainDialog, BorderLayout.CENTER);
		contentPanel.add(buttonPanel, BorderLayout.SOUTH);


		if (modelType.getIndex() == ModelType.TABLE.getIndex()) {
			//表
			prefixValue = InitDesignConfig.getTablePrefix();
		} else if (modelType.getIndex() == ModelType.VIEW.getIndex()) {
			//试图
			prefixValue = InitDesignConfig.getViewPrefix();
		}else{
			prefixText.setVisible(false);
			MatteBorder v = new MatteBorder(1, 1, 1, 1, new Color(192, 192, 192));
			enText.setBounds(400, 10, 200, 25);
			enText.setBorder(v);

		}
		prefixText.setText(prefixValue);

	}

	/**
	 * 初始化显示内容readBox.setSelectedValue(ModelStatus.NO);
	 */
	private void initCompomentValue(BlkTableMetaData model){
		cnText.setText(model.getZh_cn());
		enText.setText(model.getEn_us());
		description.setText(model.getDescribes());
		objPathText.setText(model.getObj_path());
		modelStatesBox.setSelectedValue(model.getModel_states());
		modelTypeBox.setSelectedValue(model.getModel_type());
		fieldTypeBox.setSelectedValue(model.getModel_field());
		fieldLenText.setText(String.valueOf(model.getModel_field_len()));
		primaryBox.setSelectedValue(model.getIs_primary_key());
		nullBox.setSelectedValue(model.getIs_empty());
		showWidthText.setText(String.valueOf(model.getShow_width()));
		hiddenBox.setSelectedValue(model.getIs_hidden());
		viewBox.setSelectedValue(model.getIs_viewer());
		readBox.setSelectedValue(model.getIs_reader());
		editBox.setSelectedValue(model.getIs_disabled());
		errorText.setText(model.getError_msg());
		inputText.setText(model.getInput_promit());
		groupText.setText(model.getGroup_title());
		configText.setText(model.getUser_config());
		selText.setText(model.getSel_options());
	}
	/**
	 * 显示启动窗体
	 */
	private void showDialogModel(){
		dialog.setModal(true);
		dialog.setLocationRelativeTo(MainFrame.getMainFrame());
		dialog.setVisible(true);

	    String zhText = this.getCnText();
	    String enText = this.getEnText();
	    if(StringUtils.isEmpty(zhText) || StringUtils.isEmpty(enText)){
	    	return;
	    }


	}

	/**
	 * 键盘输入改变事件
	 *
	 * @return
	 */
	private DocumentListener addListener() {
		DocumentListener action = new DocumentListener() {

			@Override
			public void changedUpdate(DocumentEvent event) {
				setEnText();
			}

			@Override
			public void insertUpdate(DocumentEvent event) {
				setEnText();
			}

			@Override
			public void removeUpdate(DocumentEvent event) {
				setEnText();
			}
		};
		return action;
	}

	/**
	 * 根据获取的中文名称获取首字母
	 */
	private void setEnText() {
		String text = cnText.getText();
		try {
			String letter = getFirstLetter(text);
			enText.setText(letter.toUpperCase());
		} catch (Exception e) {
			logger.error("获取中文首字母异常", e);
		}
	}

	/**
	 * 获取中文首字母
	 *
	 * @param txt
	 * @return
	 */
	private String getFirstLetter(String str) throws Exception {
		String convert = "";
		for (int j = 0; j < str.length(); j++) {
			char word = str.charAt(j);
			String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word, new HanyuPinyinOutputFormat());
			if (pinyinArray != null) {
				convert += pinyinArray[0].charAt(0);
			} else {
				convert += word;
			}
		}
		return convert;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	private  BlkJComboBox<String> getComBox(Class clazz){
		BlkJComboBox box = new BlkJComboBox();
		switch(clazz.getSimpleName()){
			case "ModelType":{
		        for (ModelType c : ModelType.values()) {
		        	box.addItem(c.getName());
		        }
				break;
			}
			case "ModelStates":{
		        for (ModelStates c : ModelStates.values()) {
		        	box.addItem(c.getName());
		        }
				break;
			}
			case "ModelStatus":{
		        for (ModelStatus c : ModelStatus.values()) {
		        	box.addItem(c.getName());
		        }
				break;
			}
			case "ModelField":{
		        for (ModelField c : ModelField.values()) {
		        	box.addItem(c.getName());
		        }
				break;
			}
		}
		return box;
	}

	/**
	 * 用户自定义配置
	 * @return
	 */
	private ActionListener userConfigAction(){
		ActionListener action = new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				UserConfigDialog configDialog = new UserConfigDialog();
				configDialog.setUserConfig(configText.getText());
				configDialog.setModal(true);
				configDialog.setLocationRelativeTo(dialog);
				configDialog.setVisible(true);
				configText.setText(configDialog.getUserConfig());

			}

		};

		return action;
	}

	/**
	 * 下拉列表配置
	 * @return
	 */
	private ActionListener rangConfigAction(){
		ActionListener action = new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				RangConfigDialog configDialog = new RangConfigDialog();
				configDialog.readConfig(selText.getText());
				configDialog.setModal(true);
				configDialog.setLocationRelativeTo(dialog);
				configDialog.setVisible(true);
				selText.setText(configDialog.getReturnConfig());
			}

		};
		return action;
	}

	/**
	 * 新建节点属性窗体回调函数
	 * @param zhText
	 * @param enText
	 */
	public abstract void callBack(BlkTableMetaData model);

}
